package com.itheima.stringdemo;

import java.util.Scanner;

public class StringDemo04 {
    public static void main(String[] args) {
        String rightUsername = "zhangsan";
        String rightPassword = "123456";

        Scanner sc = new Scanner(System.in);
        for (int i = 0; i < 3; i++) {
            System.out.println("请输入用户名：");
            String username = sc.next();
            System.out.println("请输入密码：");
            String password = sc.next();

            if (rightUsername.equals(username) && rightPassword.equals(password)) {
                System.out.println("登录成功");
                break;
            } else {
                System.out.println("登录失败，用户名或者密码错误");
            }
        }
    }
}
